package Clock;

import javax.swing.JOptionPane;

public class ClockThread extends Thread
{
	private Clock clock;
	private volatile boolean running = true;
	
	public ClockThread(Clock clock)
	{
		this.clock = clock;
	}

    public void run()
    {
	    while(running == true)
	    {
	    	clock.upDateClock();
	    	clock.repaint();
		    try
		    {
		    	sleep(1000); //Wait 1 second
		    }
		    catch(InterruptedException error)
		    {
		    	JOptionPane.showMessageDialog(null, "Error Display Timer", "Timer Exception", JOptionPane.ERROR_MESSAGE);
		    }
	    }
    }
}